package com.itheima.mapper;

import com.itheima.domain.Trip;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;


public interface TripMapper {
    //查询所有数据
    @Select("select * from tb_trip")
    public List<Trip> queryAll() ;

    //添加用户数据
    @Insert("insert  into  tb_trip values (null,#{username},#{gender},#{idcard},#{from_address},#{to_address},#{start_time })")
    void addTrip(Trip trip);

    //根据id查询用户数据
    @Select("select * from tb_trip where id=#{id}")
    Trip queryById(@Param("id") int i);

    //根据id修改用户数据
    @Update("update tb_trip set username= #{username},gender=#{gender},idcard=#{idcard},from_address=#{from_address},to_address=#{to_address},start_time=#{start_time } where id=#{id}")
    void updataByID(Trip trip2);

    //根据id删除用户数据
   @Delete("delete from tb_trip where id =#{id}")
    void deteleById(int i);


}
